package GUI.common.model;

import java.util.ArrayList;
import java.util.List;

import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.table.AbstractTableModel;


public class BasicComboModel extends AbstractListModel implements ComboBoxModel {

		  List list;
		  Object selection = null;

		  public BasicComboModel(List list) {
			  super();
			  this.list = list;
			  
//			  for (Object o: this.list) System.out.println(o);
		  }
		  
		  public Object getElementAt(int index) {
			Object u = this.list.get(index);
		    return u;
		  }

		  public int getSize() {
		    return this.list.size();
		  }

		  public void setSelectedItem(Object anItem) {
		    selection = anItem; // to select and register an
		  } 
		  
		  public Object getSelectedItem() {
		    return selection; // to add the selection to the combo box
		  }
}

